package com.steakliu.sun.common.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 功能说明：
 * <p>
 * Original @Author: steakliu-刘牌, 2023-01-15  19:46
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
public class StringTransUtil {

    public static String linetoHump(String str){
        if (str.contains("-")){
            str = str.toLowerCase();
            Pattern compile = Pattern.compile("-[a-z]");
            Matcher matcher = compile.matcher(str);
            StringBuilder sb = new StringBuilder();
            while(matcher.find()) {
                matcher.appendReplacement(sb,  matcher.group(0).toUpperCase().replace("-",""));
            }
            matcher.appendTail(sb);
            return sb.toString();
        }
       return str;
    }

}
